<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

	<title>Module: RConfig::Cascade</title>

	<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />

	<script src="../js/jquery.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/thickbox-compressed.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/quicksearch.js" type="text/javascript"
		charset="utf-8"></script>
	<script src="../js/darkfish.js" type="text/javascript"
		charset="utf-8"></script>

</head>
<body class="module">

	<div id="metadata">
		<div id="home-metadata">
			<div id="home-section" class="section">
        <h3 class="section-header">
          <a href="../index.html">Home</a>
          <a href="../index.html#classes">Classes</a>
          <a href="../index.html#methods">Methods</a>
        </h3>
			</div>
		</div>

		<div id="file-metadata">
			<div id="file-list-section" class="section">
				<h3 class="section-header">In Files</h3>
				<div class="section-body">
					<ul>
					
						<li><a href="../lib/rconfig/cascade_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
							class="thickbox" title="lib/rconfig/cascade.rb">lib/rconfig/cascade.rb</a></li>
					
					</ul>
				</div>
			</div>

			
		</div>

		<div id="class-metadata">

			<!-- Parent Class -->
			

			<!-- Namespace Contents -->
			

			<!-- Method Quickref -->
			
			<div id="method-list-section" class="section">
				<h3 class="section-header">Methods</h3>
				<ul class="link-list">
					
					<li><a href="#method-i-overlay%3D">#overlay=</a></li>
					
					<li><a href="#method-i-suffixes_for">#suffixes_for</a></li>
					
				</ul>
			</div>
			

			<!-- Included Modules -->
			
			<div id="includes-section" class="section">
				<h3 class="section-header">Included Modules</h3>
				<ul class="link-list">
				
				
					<li><span class="include">Constants</span></li>
				
				
				</ul>
			</div>
			
		</div>

		<div id="project-metadata">
			
			
			<div id="fileindex-section" class="section project-section">
				<h3 class="section-header">Files</h3>
				<ul>
				
					<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
				
				</ul>
			</div>
			

			<div id="classindex-section" class="section project-section">
				<h3 class="section-header">Class Index
					<span class="search-toggle"><img src="../images/find.png"
						height="16" width="16" alt="[+]"
						title="show/hide quicksearch" /></span></h3>
				<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
				<fieldset>
					<legend>Quicksearch</legend>
					<input type="text" name="quicksearch" value=""
						class="quicksearch-field" />
				</fieldset>
				</form>

				<ul class="link-list">
				
					<li><a href="../RConfig.html">RConfig</a></li>
				
					<li><a href="../RConfig/Callbacks.html">RConfig::Callbacks</a></li>
				
					<li><a href="../RConfig/Cascade.html">RConfig::Cascade</a></li>
				
					<li><a href="../RConfig/Config.html">RConfig::Config</a></li>
				
					<li><a href="../RConfig/ConfigError.html">RConfig::ConfigError</a></li>
				
					<li><a href="../RConfig/Constants.html">RConfig::Constants</a></li>
				
					<li><a href="../RConfig/CoreMethods.html">RConfig::CoreMethods</a></li>
				
					<li><a href="../RConfig/DisabledLogger.html">RConfig::DisabledLogger</a></li>
				
					<li><a href="../RConfig/Exceptions.html">RConfig::Exceptions</a></li>
				
					<li><a href="../RConfig/Generators.html">RConfig::Generators</a></li>
				
					<li><a href="../RConfig/Generators/InstallGenerator.html">RConfig::Generators::InstallGenerator</a></li>
				
					<li><a href="../RConfig/InvalidLoadPathError.html">RConfig::InvalidLoadPathError</a></li>
				
					<li><a href="../RConfig/LoadPaths.html">RConfig::LoadPaths</a></li>
				
					<li><a href="../RConfig/PropertiesFile.html">RConfig::PropertiesFile</a></li>
				
					<li><a href="../RConfig/Reload.html">RConfig::Reload</a></li>
				
					<li><a href="../RConfig/Settings.html">RConfig::Settings</a></li>
				
					<li><a href="../RConfig/Utils.html">RConfig::Utils</a></li>
				
					<li><a href="../Array.html">Array</a></li>
				
					<li><a href="../Hash.html">Hash</a></li>
				
					<li><a href="../NilClass.html">NilClass</a></li>
				
					<li><a href="../String.html">String</a></li>
				
				</ul>
				<div id="no-class-search-results" style="display: none;">No matching classes.</div>
			</div>

			
		</div>
	</div>

	<div id="documentation">
		<h1 class="module">RConfig::Cascade</h1>

		<div id="description">
			
		</div>

		<!-- Constants -->
		

		<!-- Attributes -->
		

		<!-- Methods -->
		
		<div id="public-instance-method-details" class="method-section section">
			<h3 class="section-header">Public Instance Methods</h3>

		
			<div id="overlay--method" class="method-detail ">
				<a name="method-i-overlay%3D"></a>

				<div class="method-heading">
				
					<span class="method-name">overlay=</span><span
						class="method-args">(value)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Sets a custome overlay for
</p>
					

					
					<div class="method-source-code"
						id="overlay--source">
<pre>
    <span class="ruby-comment cmt"># File lib/rconfig/cascade.rb, line 7</span>
 7:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">overlay=</span>(<span class="ruby-identifier">value</span>)
 8:       <span class="ruby-identifier">reload</span>(<span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">overlay</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">value</span>
 9:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">overlay</span> = <span class="ruby-identifier">value</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>
10:     <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
			<div id="suffixes-for-method" class="method-detail ">
				<a name="method-i-suffixes_for"></a>

				<div class="method-heading">
				
					<span class="method-name">suffixes_for</span><span
						class="method-args">(name)</span>
					<span class="method-click-advice">click to toggle source</span>
				
				</div>

				<div class="method-description">
					
					<p>
Returns a list of suffixes to try for a given config name.
</p>
<p>
A config name with an explicit overlay (e.g.: &#8216;name_GB&#8217;)
overrides any current _overlay.
</p>
<p>
This allows code to specifically ask for config overlays for a particular
locale.
</p>
					

					
					<div class="method-source-code"
						id="suffixes-for-source">
<pre>
    <span class="ruby-comment cmt"># File lib/rconfig/cascade.rb, line 21</span>
21:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">suffixes_for</span>(<span class="ruby-identifier">name</span>)
22:       <span class="ruby-identifier">name</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
23:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">suffixes</span>[<span class="ruby-identifier">name</span>] <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
24:         <span class="ruby-identifier">ol</span> = <span class="ruby-identifier">overlay</span>
25:         <span class="ruby-identifier">name_x</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">dup</span>
26:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name_x</span>.<span class="ruby-identifier">sub!</span>(<span class="ruby-regexp re">/_([A-Z]+)$/</span>, <span class="ruby-value str">''</span>)
27:           <span class="ruby-identifier">ol</span> = <span class="ruby-node">$1</span>
28:         <span class="ruby-keyword kw">end</span>
29:         <span class="ruby-identifier">name_x</span>.<span class="ruby-identifier">freeze</span>
30:         <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ol</span>
31:           <span class="ruby-identifier">ol_</span> = <span class="ruby-identifier">ol</span>.<span class="ruby-identifier">upcase</span>
32:           <span class="ruby-identifier">ol</span> = <span class="ruby-identifier">ol</span>.<span class="ruby-identifier">downcase</span>
33:           <span class="ruby-identifier">x</span> = []
34:           <span class="ruby-constant">SUFFIXES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">suffix</span><span class="ruby-operator">|</span>
35:             <span class="ruby-comment cmt"># Standard, no overlay:</span>
36:             <span class="ruby-comment cmt"># e.g.: database_&lt;suffix&gt;.yml</span>
37:             <span class="ruby-identifier">x</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">suffix</span>
38: 
39:             <span class="ruby-comment cmt"># Overlay:</span>
40:             <span class="ruby-comment cmt"># e.g.: database_(US|GB)_&lt;suffix&gt;.yml</span>
41:             <span class="ruby-identifier">x</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">ol_</span>, <span class="ruby-identifier">suffix</span>]
42:           <span class="ruby-keyword kw">end</span>
43:           [<span class="ruby-identifier">name_x</span>, <span class="ruby-identifier">x</span>.<span class="ruby-identifier">freeze</span>]
44:         <span class="ruby-keyword kw">else</span>
45:           [<span class="ruby-identifier">name</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">freeze</span>, <span class="ruby-constant">SUFFIXES</span>.<span class="ruby-identifier">freeze</span>]
46:         <span class="ruby-keyword kw">end</span>
47:         <span class="ruby-identifier">result</span>.<span class="ruby-identifier">freeze</span>
48: 
49:         <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">debug</span> <span class="ruby-node">&quot;suffixes(#{name}) =&gt; #{result.inspect}&quot;</span>
50: 
51:         <span class="ruby-identifier">result</span>
52:       <span class="ruby-keyword kw">end</span>
53:     <span class="ruby-keyword kw">end</span></pre>
					</div>
					
				</div>

				

				
			</div>

		
		</div>
	

	</div>


	<div id="rdoc-debugging-section-dump" class="debugging-section">
	
		<p>Disabled; run with --debug to generate this.</p>
	
	</div>

	<div id="validator-badges">
		<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
		<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
			Rdoc Generator</a> 1.1.6</small>.</p>
	</div>

</body>
</html>

